package org.insatandroidclub.animalsforkids.utils;

import java.util.ArrayList;
import java.util.List;

import org.insatandroidclub.animalsforkids.R;
import org.insatandroidclub.animalsforkids.model.Animal;





public class AnimalsDB {

	private List<Animal> animalsCarousel;


	public AnimalsDB()
	{
		
		animalsCarousel = new ArrayList<Animal>();
		int random = 0;
		int higher = 6;
		int lower = 0;
		int done = 0;
		ArrayList<Integer> used = new ArrayList<Integer>();
		
		Animal chat = new Animal();
		chat.setName("chat");
		chat.setId(0);
		chat.setSoundFile_e(R.raw.chat_e);
		chat.setImageFile(R.drawable.chat);
		
		
		Animal chien = new Animal();
		chien.setName("chien");
		chien.setId(1);
		chien.setSoundFile_e(R.raw.chien_e);
		chien.setImageFile(R.drawable.chien);
		
		
		Animal cheval = new Animal();
		cheval.setName("cheval");
		cheval.setId(2);
		cheval.setSoundFile_e(R.raw.cheval_e);
		cheval.setImageFile(R.drawable.cheval);
		
		
		Animal serpent = new Animal();
		serpent.setId(3);
		serpent.setName("serpent");
		serpent.setSoundFile_e(R.raw.serpent_e);
		serpent.setImageFile(R.drawable.serpent);
		
		
		
		Animal mouton = new Animal();
		mouton.setId(4);
		mouton.setName("mouton");
		mouton.setSoundFile_e(R.raw.mouton_e);
		mouton.setImageFile(R.drawable.mouton);
		
		
		
		
		
		while(done < 6)
		{
			random = (int)(Math.random() * (higher-lower)) + lower;
			if (!used.contains(random))
			{
				
				if (random == 0) animalsCarousel.add(chat);
				else if (random == 1) animalsCarousel.add(chien);
				else if (random == 2) animalsCarousel.add(cheval);
				else if (random == 3) animalsCarousel.add(serpent);
				else if (random == 4) animalsCarousel.add(mouton);
				used.add(random);
				done++;
			}
		}
		
		
		
		

	}
	
	public List<Animal> getAnimalsCarousel() {
		return animalsCarousel;
	}



	public void setAnimalsCarousel(List<Animal> animalsCarousel) {
		this.animalsCarousel = animalsCarousel;
	}

}
